import os
import pandas as pd
import csv

scores_path = ''    #scores.csv的路径
csv_path = ''           #保存的csv的路径

# 读取CSV中的文件夹名
df = pd.read_excel(scores_path)
folder_names = df.iloc[:, 0].astype(str).tolist()

with open(csv_path, "w", newline="", encoding="utf-8") as f:
    writer = csv.writer(f)
    writer.writerow(["FolderPath"])

    for i in range(6):
        folder_name = f'2020_all_zg_part{i+1}'
        folder_path = os.path.join('123', folder_name)      #123换成imedftpDir的路径
        for each_folder in os.listdir(folder_path):
            each_path = os.path.join(folder_path, each_folder)
            if each_folder not in folder_names:
                writer.writerow((each_path))

print(f"已完成，结果保存到 {csv_path}")


